<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let arr=['#a','##b','##c','###d','#e','#f','##g','##h']
    console.log(111)
    let objArr=[];
    let lengthArr=[]
    arr.map(function(i,k){
        lengthArr.push(i.slice(0,i.length-1).length)
    })
    let lvArr=[]
    lengthArr.map((i,k)=>{
        let str='1';
        if(lvArr.length>0){
            const lastStr=lvArr.slice(lvArr.length-1)[0].toString()
            if(lastStr.length<i){
                str=lastStr+'1'
            }else if(lastStr.length==i){
                str=numToString(parseInt(lastStr)+1)
            }else{
                console.log(lastStr)
                str=numToString(parseInt(lastStr.slice(0,1))+1)
            }
        }
        if(lvArr.indexOf(str)>-1){
            lvArr=lvArr.concat(numToString(parseInt(str)+1))
        }else{
            lvArr=lvArr.concat(str)
        }
    })
    function numToString(num){
        return num.toString()
    }
    lvArr=lvArr.map(i=>{
        console.log(addD(i))
        return addD(i)
    })
    function addD(str){
        return str.split('').join('.')
    }
    arr.map(function(i,k){
        objArr=objArr.concat({lv:lvArr[k],name:i.slice(i.length-1)})
    })
    console.log(objArr)

</script>

</body>
</html>
